@{
    ViewBag.Title = "部门管理";
}
@section head{
   <script type="text/javascript">
       $(document).ready(function () {

       });
       function on_close(key) {
           $('#details').treegrid('reload');
       }
       function onDeleteData() {
           $('#details').treegrid('reload');
       }

       function cmdformat(value, row, index) {
           var id = row.ID;
           if (id == undefined) id = row.id;
           return '<a href="javascript:show_fullscreen_dialog(serverUrl.edit + \'/\' + \'' + id + '\',on_close,\'edit\')">修改</a>&nbsp; <a href="javascript:Del(\'' + id + '\',onDeleteData)">删除</a>';
       }
   </script>
}
@section body{
<body style="padding:@ViewBag.Padding">
<div class="easyui-layout" data-options="fit:true">
    <div region="north" border="false">
        <div class="navigation">@ViewBag.CurrentPath</div>
        <div class="tools_box">
	        <div class="tools_bar">
                <div class="left">
                   <a href="javascript:show_fullscreen_dialog(serverUrl.add,on_close,'add')" class="easyui-linkbutton" data-options="iconCls:'icon-add',plain:true ">添加</a>  
                   <a href="javascript:DeleteSelecteds($('#details').treegrid('getSelections'),'id',onDeleteData)" class="easyui-linkbutton" data-options="iconCls:'icon-cancel',plain:true">批量删除</a>
                </div>
            </div>
        </div>
    </div> 
    <div region="center" border="false">
        <table class="easyui-treegrid" id="details" data-options="fit:true,rownumbers:true,singleSelect:false,
          pagination:false,border:true,idField:'id',treeField: 'text',onBeforeLoad:treeLoadData">
           <thead>  
               <tr>  
                   <th data-options="field:'ID',checkbox:true"></th>
                   <th data-options="field:'text',width:150">部门名称</th>
                   <th data-options="field:'id',width:100 ">部门代号</th>
                   <th data-options="field:'managerCount',width:100 ">部门人数</th>
                   <th data-options="field:'cmd',width:100,align:'center',formatter:cmdformat">操作</th>
               </tr>  
           </thead>  
        </table>
    </div>
</div>
</body>
}